TPT-4261: Implement integration tests for Expand Create Linodes Options and Password-less Linodes#693
Open
Conversation
…d_keys_root_pass_are_not_set and def test_create_linode_with_kernel_and_boot_size_then_add_disk_and_rebuild
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new integration coverage around Linode creation options (kernel, boot_size) and validation behavior when creating an Instance from an Image without root_pass / authorized_users / authorized_keys.
Changes:
- Adds a new session-scoped fixture that creates a Linode using
kernelandboot_sizewithauthorized_keys. - Adds an integration test asserting
instance_createraises aValueErrorwhen none ofroot_pass,authorized_users, orauthorized_keysare provided. - Adds an integration test that creates a disk and then rebuilds the Linode.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+245
to
+253
| linode_instance = client.linode.instance_create( | ||
| "g6-nanode-1", | ||
| region, | ||
| image="linode/debian12", | ||
| label=label, | ||
| kernel="linode/6.15.7-x86_64-linode169", | ||
| boot_size=9000, | ||
| authorized_keys="ssh-rsa", | ||
| ) |
| region, | ||
| image="linode/debian12", | ||
| label=label, | ||
| kernel="linode/6.15.7-x86_64-linode169", |
Comment on lines
+242
to
+252
| region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core") | ||
| label = get_test_label(length=8) | ||
|
|
||
| linode_instance = client.linode.instance_create( | ||
| "g6-nanode-1", | ||
| region, | ||
| image="linode/debian12", | ||
| label=label, | ||
| kernel="linode/6.15.7-x86_64-linode169", | ||
| boot_size=9000, | ||
| authorized_keys="ssh-rsa", |
| image="linode/debian12", | ||
| label=label, | ||
| kernel="linode/6.15.7-x86_64-linode169", | ||
| boot_size="9000", |
| 3, | ||
| linode_create.rebuild, | ||
| "linode/debian12", | ||
| authorized_keys="ecdsa-sha2-nistp", |
| authorized_keys="ecdsa-sha2-nistp", | ||
| ) | ||
| wait_for_condition(10, 300, get_status, linode_create, "rebuilding") | ||
| assert linode_create.status == "rebuilding" |
Comment on lines
+238
to
+243
| @pytest.fixture(scope="session") | ||
| def create_linode_with_authorization_key(test_linode_client, ssh_key_gen): | ||
| client = test_linode_client | ||
|
|
||
| region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core") | ||
| label = get_test_label(length=8) |
Comment on lines
+1187
to
+1208
| def test_expected_error_if_fields_authorized_users_authorized_keys_root_pass_are_not_set( | ||
| test_linode_client, | ||
| ): | ||
| client = test_linode_client | ||
| region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core") | ||
| label = get_test_label(length=8) | ||
|
|
||
| with pytest.raises(ValueError) as create_instance_error: | ||
| client.linode.instance_create( | ||
| "g6-nanode-1", | ||
| region, | ||
| image="linode/debian12", | ||
| label=label, | ||
| kernel="linode/latest-64bit", | ||
| boot_size=9000, | ||
| ) | ||
| assert ( | ||
| "When creating an Instance from an Image, at least one of root_pass, authorized_users, or authorized_keys must be provided." | ||
| in str(create_instance_error.value) | ||
| ) | ||
|
|
||
|
|
Comment on lines
+1227
to
+1232
| retry_sending_request( | ||
| 3, | ||
| linode_create.rebuild, | ||
| "linode/debian12", | ||
| authorized_keys="ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJ0QO0FQx0J8l8n1aX4d7p0mW0uQ1u7m0mK2K9m1g3rX6m4sYv0r2g1W9m8pQ3x5r7t1n6v8k2p4s6d9f1h3j5k= integration-test", | ||
| ) |
| @@ -1,4 +1,5 @@ | |||
| import ipaddress | |||
| import random | |||
Contributor
Author
There was a problem hiding this comment.
Without this import there is error NameError: name 'random' is not defined.
34254e0 to
44b0454
Compare
ezilber-akamai
approved these changes
May 8, 2026
Contributor
ezilber-akamai
left a comment
There was a problem hiding this comment.
Tests are passing locally. There are a few remaining stylistic CoPilot suggestions but nothing critical. Nice work!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Implement integration tests for Expand Create Linodes Options and Password-less Linodes
✔️ How to Test
make TEST_CASE=test_expected_error_if_fields_authorized_users_authorized_keys_root_pass_are_not_set test-int
make TEST_CASE=test_create_linode_with_kernel_and_boot_size_then_add_disk_and_rebuild test-int